package com.wmy.luckywheel.controller;

import com.wmy.luckywheel.entity.Result;
import com.wmy.luckywheel.service.RecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wmy.luckywheel.entity.po.Record;
import java.util.List;

/**
 * @author Sian37
 * 中奖记录
 */

@RestController
@RequestMapping("/record")
@RequiredArgsConstructor
@Slf4j
public class RecordController {

    private final RecordService recordService;

    @GetMapping
    public Result<List<Record>> queryList() {
        log.info("查询抽奖记录");
        List<Record> records = recordService.queryList();
        return Result.success(records);
    }

    @PostMapping("/add")
    public Result<Void> add() {
        log.info("添加抽奖记录");
        Record record = new Record();
        recordService.add(record);
        return Result.success();
    }
}
